package com.example.wechat.activity;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.wechat.R;
import com.example.wechat.model.Contact;

public class ContactDetailActivity extends AppCompatActivity {
    public static final String EXTRA_CONTACT = "extra_contact";

    private ImageView avatarImageView;
    private TextView nameTextView;
    private TextView remarkTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_contact_detail);

        avatarImageView = findViewById(R.id.avatarImageView);
        nameTextView = findViewById(R.id.nameTextView);
        remarkTextView = findViewById(R.id.remarkTextView);

        Contact contact = getIntent().getParcelableExtra(EXTRA_CONTACT);
        if (contact != null) {
            loadContactData(contact);
        }
    }

    private void loadContactData(Contact contact) {
        avatarImageView.setImageResource(contact.getAvatarResId());
        nameTextView.setText(contact.getName());
        remarkTextView.setText(contact.getRemark());
    }
} 